package net.rokyinfo.basecommon.util;

/**
 * Created by Administrator on 2017-03-10.
 */
public class HexUtil {
    /**
     * hex字符串转byte数组<br/>
     * 2个hex转为一个byte
     * @param src
     * @return
     */
    public static byte[] hex2Bytes(String src){
        byte[] res = new byte[src.length()/2];
        char[] chs = src.toCharArray();
        for(int i=0,c=0; i<chs.length; i+=2,c++){
            res[c] = (byte) (Integer.parseInt(new String(chs,i,2), 16));
        }

        return res;
    }
}
